//
//  MsgViewModel.m
//  ForYourBeauty
//
//  Created by Kelly xu on 2019/7/4.
//  Copyright © 2019 changrenTech. All rights reserved.
//

#import "MsgViewModel.h"

@implementation MsgViewModel
-(void)fetchMsgList:(void(^)(NSArray *msgList))cmp{
    [[HttpClient shareClient]postWithUrl:MSG_LIST params:@{
                                                          @"blurSearch": @{},
                                                          @"order": @{},
                                                          @"p": @(0),
                                                          @"search": @{},
                                                          @"size": @(10)
                                                          } suc:^(id results) {
                                                              NSArray *list = [results objectForKey:@"resultList"];
                                                              NSMutableArray *msgList = [[NSMutableArray alloc]init];
                                                              for (NSDictionary *item in list) {
                                                                  [msgList addObject:[MsgListModel modelObjectWithDictionary:item]];
                                                              }
                                                              cmp(msgList);
                                                          } fail:^(NSString *error, NSInteger status) {
                                                              Toast(error);
                                                          }];
}
@end
